<?php
/*------------------------------------------------------------------------------
this file is part of Web Application Kit http://webappkit.net
Copyright (C) 2006 J.Ducastel <fredbird@fredbird.org>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
------------------------------------------------------------------------------*/

/**
* databeans storage in ini file
* @author J.Ducastel <fredbird@fredbird.org>
* @version 
*/
class dataBeanStore_ini extends iniFileNode {
/*------------------------------------------------------------------------------
                                                                     constructor
------------------------------------------------------------------------------*/
	/**
	*
	* @access
	* /
	function wakDatabeanStore_ini($file,$class=null) {
		$this->__construct($file,$class);
	}/**/
	
	/**
	*
	* @access
	* /
	function __construct($file,$class=null) {
		$lib=&wak::getservice('waklib');
		$lib->needclass('inifilenode');
		$this->ini=&new inifilenode($file);
		if ($class) $this->databean_class=$class;
		$lib->needclass($class);
	}/**/
/*------------------------------------------------------------------------------
                                                                  public methods
------------------------------------------------------------------------------*/
	/**
	* 
	* @param
	* @access public
	* @return 
	* /
	function getById($id) {
		$data=$this->ini
	}/**/
	
	/**
	* returns all databeans in array
	* @access public
	* @return array
	*/
	function getAll() {
		//$deb=&wak::getservice('wakdebug');
		$data=$this->getdata();
		//echo $deb->vardump($data);
		$beans=array();
		foreach ($data as $id => $section) {
			$beans[$id]=&$this->buildDataBean($section);
			// echo "<p>built ".$deb->vardump($beans[$id])."</p>";
		}
		return $beans;
	}/**/
	
	/**
	* insert a new bean into store
	* @param
	* @access public
	* @return string inserted bean id
	* /
	function insert($bean) {
		
	}/**/
	
	/**
	* sets beans class
	* @param string $class
	* @access public
	* @return bool
	*/
	function setClass($class) {
		$this->databean_class=$class;
		return true;
	}/**/
	
	/**
	* 
	* @param
	* @access public
	* @return 
	* /
	function () {
		
	}/**/
	
	/**
	* 
	* @param
	* @access public
	* @return 
	* /
	function () {
		
	}/**/
/*------------------------------------------------------------------------------
                                                                      properties
------------------------------------------------------------------------------*/
	/**
	* @var type desc
	*/
	var $databean_class='databean';
	// var $_file; // storage file
	// var $ini; // iniFileNode instance
/*------------------------------------------------------------------------------
                                                                 private methods
------------------------------------------------------------------------------*/
	/**
	* 
	* @param
	* @access private
	* @return 
	*/
	function & buildDataBean($data) {
		$class=$this->databean_class;
		$bean=new $class($data);
		return $bean;
	}/**/
	
	/**
	* 
	* @param
	* @access private
	* @return 
	* /
	function () {
		
	}/**/
}
?>
